{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import json\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "from sklearn.feature_extraction import text\n",
    "from sklearn.linear_model import LogisticRegression\n",
    "import sklearn.model_selection as modsel\n",
    "import sklearn.preprocessing as preproc"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Load and prep Yelp reviews data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "## Load Yelp Business data\n",
    "biz_f = open('data/yelp/v6/yelp_dataset_challenge_academic_dataset/yelp_academic_dataset_business.json')\n",
    "biz_df = pd.DataFrame([json.loads(x) for x in biz_f.readlines()])\n",
    "biz_f.close()\n",
    "\n",
    "## Load Yelp Reviews data\n",
    "review_file = open('data/yelp/v6/yelp_dataset_challenge_academic_dataset/yelp_academic_dataset_review.json')\n",
    "review_df = pd.DataFrame([json.loads(x) for x in review_file.readlines()])\n",
    "review_file.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "biz_df.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "review_df.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Pull out only Nightlife and Restaurants businesses\n",
    "two_biz = biz_df[biz_df.apply(lambda x: 'Nightlife' in x['categories'] \n",
    "                                        or 'Restaurants' in x['categories'], \n",
    "                              axis=1)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(24187, 15)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "two_biz.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(61184, 15)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "biz_df.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "## Join with the reviews to get all reviews on the two types of business\n",
    "twobiz_reviews = two_biz.merge(review_df, on='business_id', how='inner')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(1061863, 22)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "twobiz_reviews.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "twobiz_reviews.to_pickle('data/yelp/v6/yelp_dataset_challenge_academic_dataset/twobiz_reviews.pkl')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "twobiz_reviews = pd.read_pickle('data/yelp/v6/yelp_dataset_challenge_academic_dataset/twobiz_reviews.pkl')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Trim away the features we won't use\n",
    "twobiz_reviews = twobiz_reviews[['business_id', \n",
    "                                 'name', \n",
    "                                 'stars_y', \n",
    "                                 'text', \n",
    "                                 'categories']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Create the target column--True for Nightlife businesses, and False otherwise\n",
    "twobiz_reviews['target'] = twobiz_reviews.apply(lambda x: 'Nightlife' in x['categories'],\n",
    "                                                axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "## Now pull out each class of reviews separately, \n",
    "## so we can create class-balanced samples for training\n",
    "nightlife = twobiz_reviews[twobiz_reviews.apply(lambda x: 'Nightlife' in x['categories'], axis=1)]\n",
    "restaurants = twobiz_reviews[twobiz_reviews.apply(lambda x: 'Restaurants' in x['categories'], axis=1)]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(210028, 5)"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nightlife.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(990627, 5)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "restaurants.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "nightlife_subset = nightlife.sample(frac=0.1, random_state=123)\n",
    "restaurant_subset = restaurants.sample(frac=0.021, random_state=123)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(21003, 5)"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nightlife_subset.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(20803, 5)"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "restaurant_subset.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "nightlife_subset.to_pickle('data/yelp/v6/yelp_dataset_challenge_academic_dataset/nightlife_subset.pkl')\n",
    "restaurant_subset.to_pickle('data/yelp/v6/yelp_dataset_challenge_academic_dataset/restaurant_subset.pkl')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "nightlife_subset = pd.read_pickle('data/yelp/v6/yelp_dataset_challenge_academic_dataset/nightlife_subset.pkl')\n",
    "restaurant_subset = pd.read_pickle('data/yelp/v6/yelp_dataset_challenge_academic_dataset/restaurant_subset.pkl')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "combined = pd.concat([nightlife_subset, restaurant_subset])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "combined['target'] = combined.apply(lambda x: 'Nightlife' in x['categories'],\n",
    "                                    axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>business_id</th>\n",
       "      <th>name</th>\n",
       "      <th>stars_y</th>\n",
       "      <th>text</th>\n",
       "      <th>categories</th>\n",
       "      <th>target</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>223202</th>\n",
       "      <td>aRkYtXfmEKYG-eTDf_qUsw</td>\n",
       "      <td>Lux</td>\n",
       "      <td>5</td>\n",
       "      <td>You have to try the velvet!!! Lux is so to die...</td>\n",
       "      <td>[Coffee &amp; Tea, Food, Bars, Nightlife, American...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>365597</th>\n",
       "      <td>k-D2NUfaUbuQzPaMXniXcA</td>\n",
       "      <td>The Pub at Monte Carlo</td>\n",
       "      <td>3</td>\n",
       "      <td>This joint is hit or miss on the nite scene......</td>\n",
       "      <td>[Pubs, Bars, American (Traditional), Nightlife...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>399883</th>\n",
       "      <td>adv1-kA6k2N4L-e4zULuNg</td>\n",
       "      <td>Fremont Street Experience</td>\n",
       "      <td>5</td>\n",
       "      <td>it's always fun to \"people watch\" on fremont c...</td>\n",
       "      <td>[Casinos, Bars, Arts &amp; Entertainment, Nightlife]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>175018</th>\n",
       "      <td>_F2DNPjsqgkAd50zuX8dYQ</td>\n",
       "      <td>Harold's Corral</td>\n",
       "      <td>2</td>\n",
       "      <td>Went for another try at Sunday Brunch. First o...</td>\n",
       "      <td>[American (Traditional), Steakhouses, Nightlif...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>647870</th>\n",
       "      <td>tLLz1fzVjG84LF-mv9hAEw</td>\n",
       "      <td>Mandarin Bar</td>\n",
       "      <td>5</td>\n",
       "      <td>I like and probably prefer a dive bar over hig...</td>\n",
       "      <td>[Bars, Nightlife, Lounges]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1058274</th>\n",
       "      <td>YYM9p7iV3A3dGtsqjemqBw</td>\n",
       "      <td>Echo 5 Sports Pub</td>\n",
       "      <td>5</td>\n",
       "      <td>What a great find! Service was awesome, food w...</td>\n",
       "      <td>[Bars, Restaurants, American (Traditional), Sp...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>538477</th>\n",
       "      <td>4xqn5hGqXKcU7_pY5lKYOQ</td>\n",
       "      <td>Hawthorne's NY Pizza &amp; Bar</td>\n",
       "      <td>2</td>\n",
       "      <td>went there for \"the best in pizza in Charlotte...</td>\n",
       "      <td>[Italian, Bars, Pizza, Nightlife, Restaurants]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26030</th>\n",
       "      <td>IgaruuknYwCr9afeDYQ_yw</td>\n",
       "      <td>Dirty Drummer</td>\n",
       "      <td>4</td>\n",
       "      <td>A clean dive bar neatly disguised as a sports ...</td>\n",
       "      <td>[Nightlife, Restaurants]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>606932</th>\n",
       "      <td>3n9mSKySEv3G03YjcU-YOQ</td>\n",
       "      <td>Postino Central</td>\n",
       "      <td>5</td>\n",
       "      <td>This is my new favorite restaurant in Phoenix....</td>\n",
       "      <td>[Bars, Breakfast &amp; Brunch, Wine Bars, Nightlif...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>125852</th>\n",
       "      <td>LLR8iqKn7nmfwXWl1S13Lw</td>\n",
       "      <td>Hawk's Bar &amp; Grill</td>\n",
       "      <td>4</td>\n",
       "      <td>Med plate is great, price is fair. Even the sm...</td>\n",
       "      <td>[Bars, Restaurants, American (Traditional), Sp...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44114</th>\n",
       "      <td>RKOS92ptLgEU3BUNMtDHrw</td>\n",
       "      <td>Bobby C's Bar &amp; Lounge</td>\n",
       "      <td>2</td>\n",
       "      <td>This Review Brought to you by the Letter \"L\"\\n...</td>\n",
       "      <td>[Jazz &amp; Blues, Arts &amp; Entertainment, Soul Food...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>582925</th>\n",
       "      <td>Es300Ys1XXPYg8aI7BKVYQ</td>\n",
       "      <td>XS Nightclub</td>\n",
       "      <td>4</td>\n",
       "      <td>My girlfriends &amp; I recently went to Vegas for ...</td>\n",
       "      <td>[Nightlife, Dance Clubs]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>975188</th>\n",
       "      <td>-4bNlx03GsXzgkHZwTrMaw</td>\n",
       "      <td>Redbeard's On Sixth</td>\n",
       "      <td>2</td>\n",
       "      <td>Food was cold at all stages of the meal. Dip T...</td>\n",
       "      <td>[Bars, American (Traditional), Pubs, Nightlife...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>743863</th>\n",
       "      <td>7q1FpSXbE6XtLNg518pxDA</td>\n",
       "      <td>Miller's Alehouse</td>\n",
       "      <td>5</td>\n",
       "      <td>Just had a great lunch at Ale House! Our serve...</td>\n",
       "      <td>[Nightlife, Bars, American (Traditional), Spor...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>893313</th>\n",
       "      <td>xE9-TVvDM9qp_eh0oGCpTA</td>\n",
       "      <td>Oracle Nightclub</td>\n",
       "      <td>4</td>\n",
       "      <td>I'm not the one to go to clubs much, mainly be...</td>\n",
       "      <td>[Bars, Hookah Bars, Nightlife, Dance Clubs]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>316312</th>\n",
       "      <td>uqisw8IXD5ZutU4MT2MQVw</td>\n",
       "      <td>Social House</td>\n",
       "      <td>3</td>\n",
       "      <td>Not really a sushi restaurant, woefully overpr...</td>\n",
       "      <td>[Bars, Japanese, Asian Fusion, Nightlife, Loun...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>606965</th>\n",
       "      <td>3n9mSKySEv3G03YjcU-YOQ</td>\n",
       "      <td>Postino Central</td>\n",
       "      <td>4</td>\n",
       "      <td>I have been to the Arcadia location quite a fe...</td>\n",
       "      <td>[Bars, Breakfast &amp; Brunch, Wine Bars, Nightlif...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>257517</th>\n",
       "      <td>ES-j5yNTgmgbL4He0h6otA</td>\n",
       "      <td>Hofbrauhaus - Las Vegas</td>\n",
       "      <td>5</td>\n",
       "      <td>Hofbrauhaus used to be a hidden gem in Vegas, ...</td>\n",
       "      <td>[German, Bars, Nightlife, Restaurants]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>316133</th>\n",
       "      <td>uqisw8IXD5ZutU4MT2MQVw</td>\n",
       "      <td>Social House</td>\n",
       "      <td>5</td>\n",
       "      <td>Yes! Social House was fantastic at TI. It's mo...</td>\n",
       "      <td>[Bars, Japanese, Asian Fusion, Nightlife, Loun...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31284</th>\n",
       "      <td>Pfb6VOIiroqDWOebfgWGPQ</td>\n",
       "      <td>Phoenix City Grille</td>\n",
       "      <td>5</td>\n",
       "      <td>We parked in the back and came in through a se...</td>\n",
       "      <td>[Pubs, Bars, Nightlife, Irish, Restaurants]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>640078</th>\n",
       "      <td>CDN--GWL8gm4TsFFtccpaA</td>\n",
       "      <td>Azure Luxury Pool</td>\n",
       "      <td>1</td>\n",
       "      <td>As we walked towards TAO beach, we were greete...</td>\n",
       "      <td>[Active Life, Swimming Pools, Dance Clubs, Nig...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>414972</th>\n",
       "      <td>stKD-HqTxDMylPonFyVdWA</td>\n",
       "      <td>Boardwalk Billys Raw Bar &amp; Ribs</td>\n",
       "      <td>2</td>\n",
       "      <td>The best thing on this menu is the hot peel an...</td>\n",
       "      <td>[Bars, American (Traditional), Nightlife, Spor...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>608519</th>\n",
       "      <td>0_J4y0aEmtuzgdsH2OfWQw</td>\n",
       "      <td>Don't Tell Mama</td>\n",
       "      <td>3</td>\n",
       "      <td>Nice little piano bar, I have heard about it's...</td>\n",
       "      <td>[Bars, Nightlife, Lounges]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>998043</th>\n",
       "      <td>IOwuFFUwRljuOxatDCGm6w</td>\n",
       "      <td>The House of Brews</td>\n",
       "      <td>1</td>\n",
       "      <td>Wow...this place has really gone down. New men...</td>\n",
       "      <td>[Nightlife, Bars, American (New), Sports Bars,...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1061</th>\n",
       "      <td>2SwC8wqpZC4B9iFVTgYT9A</td>\n",
       "      <td>Casbah</td>\n",
       "      <td>4</td>\n",
       "      <td>So I hated this Soba place owned by the same p...</td>\n",
       "      <td>[Wine Bars, Bars, Mediterranean, Nightlife, Re...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>351541</th>\n",
       "      <td>WNy1uzcmm_UHmTyR--o5IA</td>\n",
       "      <td>Cornish Pasty Company</td>\n",
       "      <td>5</td>\n",
       "      <td>Wow...we loved this place!  I had bookmarked t...</td>\n",
       "      <td>[Pubs, Bars, Nightlife, British, Restaurants]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>716691</th>\n",
       "      <td>OdD1GuGNQ64ssJmMJ_D9RQ</td>\n",
       "      <td>The Duce</td>\n",
       "      <td>1</td>\n",
       "      <td>Cool place but don't try to arrange a special ...</td>\n",
       "      <td>[Bars, Nightlife, Lounges]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1125</th>\n",
       "      <td>2SwC8wqpZC4B9iFVTgYT9A</td>\n",
       "      <td>Casbah</td>\n",
       "      <td>5</td>\n",
       "      <td>I enjoy coming to Casbah because it reminds me...</td>\n",
       "      <td>[Wine Bars, Bars, Mediterranean, Nightlife, Re...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>900253</th>\n",
       "      <td>40xXIs_WIOvrhtbS7QJ1ZQ</td>\n",
       "      <td>Four Sevens Sports Bar &amp; Restaurant</td>\n",
       "      <td>4</td>\n",
       "      <td>Needed a good spot for an after work beverage ...</td>\n",
       "      <td>[Bars, Restaurants, Sports Bars, Chinese, Nigh...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>430613</th>\n",
       "      <td>6gugg5XY66ukGewmOptSKw</td>\n",
       "      <td>The Steakhouse at Camelot</td>\n",
       "      <td>3</td>\n",
       "      <td>The food was great. The service sucked. The wa...</td>\n",
       "      <td>[Bars, Steakhouses, American (Traditional), Ni...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177165</th>\n",
       "      <td>ErTR62P1wNPelAbHkr_9cw</td>\n",
       "      <td>Fuego Steakhouse</td>\n",
       "      <td>5</td>\n",
       "      <td>If there's one thing I know after spending the...</td>\n",
       "      <td>[Steakhouses, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>245413</th>\n",
       "      <td>4bEjOyTaDG24SY5TxsaUNQ</td>\n",
       "      <td>Mon Ami Gabi</td>\n",
       "      <td>5</td>\n",
       "      <td>We love this place. It is a must stop for us w...</td>\n",
       "      <td>[Breakfast &amp; Brunch, Steakhouses, French, Rest...</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>364268</th>\n",
       "      <td>Vtx0VYkybAd71fzwgaoQ8g</td>\n",
       "      <td>The Skeptical Chymist</td>\n",
       "      <td>4</td>\n",
       "      <td>Came here on a Saturday night and the band was...</td>\n",
       "      <td>[Pubs, Bars, Nightlife, Irish, Restaurants]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>587462</th>\n",
       "      <td>RhqrOvy6Zr8vn5pJ9PkF1A</td>\n",
       "      <td>Wazuzu</td>\n",
       "      <td>5</td>\n",
       "      <td>Another great meal at Wazuzu.  Chef Jet is a s...</td>\n",
       "      <td>[Diners, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>357168</th>\n",
       "      <td>KBG28p3lGX17hOPoHhq5PQ</td>\n",
       "      <td>Yasu Sushi Bistro</td>\n",
       "      <td>5</td>\n",
       "      <td>I want to give this place 7 stars! My only reg...</td>\n",
       "      <td>[Sushi Bars, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>234987</th>\n",
       "      <td>c7pNpJMmvRXBpC_8kj76nA</td>\n",
       "      <td>Lang Van Vietnamese</td>\n",
       "      <td>5</td>\n",
       "      <td>After spending the early afternoon at the Char...</td>\n",
       "      <td>[Vietnamese, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>601625</th>\n",
       "      <td>6nfTUgP3UvQ_jhnT8kCpew</td>\n",
       "      <td>Hon Machi</td>\n",
       "      <td>4</td>\n",
       "      <td>We went here on a Monday night and reluctantly...</td>\n",
       "      <td>[Sushi Bars, Japanese, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>440658</th>\n",
       "      <td>8o-NLKy_XfbJtqljX9XLCA</td>\n",
       "      <td>Mrs White's Golden Rule Cafe</td>\n",
       "      <td>5</td>\n",
       "      <td>Been coming here for a few months, but tonight...</td>\n",
       "      <td>[Soul Food, Southern, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>410026</th>\n",
       "      <td>2AB_43WAw7cNvMcm-QEliw</td>\n",
       "      <td>Sushi Tower &amp; Steakhouse</td>\n",
       "      <td>4</td>\n",
       "      <td>I've been here quite a few times and I love it...</td>\n",
       "      <td>[Steakhouses, Sushi Bars, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>366903</th>\n",
       "      <td>fZVZeZJkziJ7B1rIcmT3Iw</td>\n",
       "      <td>Sierra Gold</td>\n",
       "      <td>4</td>\n",
       "      <td>I haven't been to Sierra Gold in quite a while...</td>\n",
       "      <td>[Bars, Pubs, Nightlife, American (New), Sports...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>832706</th>\n",
       "      <td>IRYj1b1-mlXqABVsl9SoqQ</td>\n",
       "      <td>Tacos El Gordo</td>\n",
       "      <td>5</td>\n",
       "      <td>Hands down best taco joint I have ever been to...</td>\n",
       "      <td>[Mexican, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>481156</th>\n",
       "      <td>simnCuMX4OVwIhWaIqL4zA</td>\n",
       "      <td>Red House</td>\n",
       "      <td>5</td>\n",
       "      <td>I told myself no more five stars but I love th...</td>\n",
       "      <td>[Chinese, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>209427</th>\n",
       "      <td>r70nuDpkR5-g1oShW2ANvA</td>\n",
       "      <td>Crown &amp; Anchor British Pub</td>\n",
       "      <td>5</td>\n",
       "      <td>Bloody Brilliant! Excellent choice of beers on...</td>\n",
       "      <td>[Pubs, Bars, Nightlife, British, Restaurants]</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>463651</th>\n",
       "      <td>CEPvTz9BU_wK45zZoQNhrw</td>\n",
       "      <td>Tequileria</td>\n",
       "      <td>2</td>\n",
       "      <td>Can I have more steak with this Fat!? Geez! It...</td>\n",
       "      <td>[Mexican, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>808672</th>\n",
       "      <td>nZgYNbl1XlZyyKlISMoG6w</td>\n",
       "      <td>Sugar Factory American Brasserie</td>\n",
       "      <td>1</td>\n",
       "      <td>I went to the Sugar Factory for breakfast last...</td>\n",
       "      <td>[Breakfast &amp; Brunch, Bars, American (New), Nig...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>344165</th>\n",
       "      <td>FqzgT9Y-Yu7jiWdHnGW-kQ</td>\n",
       "      <td>The Vig</td>\n",
       "      <td>5</td>\n",
       "      <td>Probably the best bowl of Posole that I have h...</td>\n",
       "      <td>[Bars, American (Traditional), Pubs, Nightlife...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>980915</th>\n",
       "      <td>6O9iAmAv7vUl-Eeqb9bmpw</td>\n",
       "      <td>Wahoo's Fish Tacos</td>\n",
       "      <td>3</td>\n",
       "      <td>The food was alright, I guess.  Nothing too gr...</td>\n",
       "      <td>[Seafood, Mexican, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>144580</th>\n",
       "      <td>g3WAdIH2ULX6hFI6hOfBWw</td>\n",
       "      <td>Got Sushi</td>\n",
       "      <td>1</td>\n",
       "      <td>This place made me so sick and I have an iron ...</td>\n",
       "      <td>[Japanese, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>189706</th>\n",
       "      <td>LOef7o-dnn7Z5qGMZCi6pw</td>\n",
       "      <td>Circo</td>\n",
       "      <td>5</td>\n",
       "      <td>If you love eating fine cuisine, but cannot qu...</td>\n",
       "      <td>[Restaurants, Italian]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>137545</th>\n",
       "      <td>NQhPkGeHiljeg7tXPTHJeA</td>\n",
       "      <td>Sweet Tomatoes</td>\n",
       "      <td>4</td>\n",
       "      <td>Every once in a while after eating poorly, I n...</td>\n",
       "      <td>[Vegetarian, Buffets, Salad, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>868430</th>\n",
       "      <td>05fTEsjUPVo5jks8PpNKCQ</td>\n",
       "      <td>Rollin Smoke Barbeque</td>\n",
       "      <td>4</td>\n",
       "      <td>Great food nice clean place! No real BBQ in Ve...</td>\n",
       "      <td>[Burgers, Soul Food, Barbeque, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>303238</th>\n",
       "      <td>UL3OMN_c-NXHlyb97pDifA</td>\n",
       "      <td>Yard House</td>\n",
       "      <td>4</td>\n",
       "      <td>I love this place for their fantastic martinis...</td>\n",
       "      <td>[Nightlife, Vegetarian, American (New), Bars, ...</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>516017</th>\n",
       "      <td>r4AG1WXCRWkZKQctrcy9FA</td>\n",
       "      <td>Grimaldi's Pizzeria</td>\n",
       "      <td>4</td>\n",
       "      <td>I am fast becoming a pizza afficianado.    We ...</td>\n",
       "      <td>[Pizza, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>454032</th>\n",
       "      <td>SNTDhGh-AdBPKFfq6xCsRA</td>\n",
       "      <td>Kings Fish House</td>\n",
       "      <td>5</td>\n",
       "      <td>Five stars to Kings for their generosity.\\n\\nM...</td>\n",
       "      <td>[Seafood, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1017805</th>\n",
       "      <td>TNpJsewe0H__8fzBgaHCzg</td>\n",
       "      <td>Angelina's Pizzeria</td>\n",
       "      <td>4</td>\n",
       "      <td>Pretty good pizza. Fast delivery. This used to...</td>\n",
       "      <td>[Italian, Pizza, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>300150</th>\n",
       "      <td>KlAARyLySLdoyT8QxJFSIg</td>\n",
       "      <td>The Prime Rib Loft</td>\n",
       "      <td>4</td>\n",
       "      <td>No thanks to our server, we will be back.\\n\\nT...</td>\n",
       "      <td>[Steakhouses, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>938078</th>\n",
       "      <td>vDEC5kHgtjkqyuZAZrSuMA</td>\n",
       "      <td>Pho Annie</td>\n",
       "      <td>4</td>\n",
       "      <td>Awesome place. Usually a return customer of th...</td>\n",
       "      <td>[Vietnamese, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>986467</th>\n",
       "      <td>XfVGU6WGZKc867spn2TImw</td>\n",
       "      <td>Pomo Pizzeria Napoletana - Phoenix</td>\n",
       "      <td>4</td>\n",
       "      <td>Great vibe in this place. Very friendly staff....</td>\n",
       "      <td>[Italian, Pizza, Sandwiches, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54382</th>\n",
       "      <td>JNEeWjajyZPrwMb1cYi_pg</td>\n",
       "      <td>Creative Cafe</td>\n",
       "      <td>5</td>\n",
       "      <td>Just passing through town and found this great...</td>\n",
       "      <td>[American (New), Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>251637</th>\n",
       "      <td>tFU2Js_nbIZOrnKfYJYBBg</td>\n",
       "      <td>Bouchon Bistro</td>\n",
       "      <td>5</td>\n",
       "      <td>No reservations and its always packed so get t...</td>\n",
       "      <td>[Breakfast &amp; Brunch, French, Restaurants]</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>41806 rows × 6 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                    business_id                                 name  stars_y  \\\n",
       "223202   aRkYtXfmEKYG-eTDf_qUsw                                  Lux        5   \n",
       "365597   k-D2NUfaUbuQzPaMXniXcA               The Pub at Monte Carlo        3   \n",
       "399883   adv1-kA6k2N4L-e4zULuNg            Fremont Street Experience        5   \n",
       "175018   _F2DNPjsqgkAd50zuX8dYQ                      Harold's Corral        2   \n",
       "647870   tLLz1fzVjG84LF-mv9hAEw                         Mandarin Bar        5   \n",
       "1058274  YYM9p7iV3A3dGtsqjemqBw                    Echo 5 Sports Pub        5   \n",
       "538477   4xqn5hGqXKcU7_pY5lKYOQ           Hawthorne's NY Pizza & Bar        2   \n",
       "26030    IgaruuknYwCr9afeDYQ_yw                        Dirty Drummer        4   \n",
       "606932   3n9mSKySEv3G03YjcU-YOQ                      Postino Central        5   \n",
       "125852   LLR8iqKn7nmfwXWl1S13Lw                   Hawk's Bar & Grill        4   \n",
       "44114    RKOS92ptLgEU3BUNMtDHrw               Bobby C's Bar & Lounge        2   \n",
       "582925   Es300Ys1XXPYg8aI7BKVYQ                         XS Nightclub        4   \n",
       "975188   -4bNlx03GsXzgkHZwTrMaw                  Redbeard's On Sixth        2   \n",
       "743863   7q1FpSXbE6XtLNg518pxDA                    Miller's Alehouse        5   \n",
       "893313   xE9-TVvDM9qp_eh0oGCpTA                     Oracle Nightclub        4   \n",
       "316312   uqisw8IXD5ZutU4MT2MQVw                         Social House        3   \n",
       "606965   3n9mSKySEv3G03YjcU-YOQ                      Postino Central        4   \n",
       "257517   ES-j5yNTgmgbL4He0h6otA              Hofbrauhaus - Las Vegas        5   \n",
       "316133   uqisw8IXD5ZutU4MT2MQVw                         Social House        5   \n",
       "31284    Pfb6VOIiroqDWOebfgWGPQ                  Phoenix City Grille        5   \n",
       "640078   CDN--GWL8gm4TsFFtccpaA                    Azure Luxury Pool        1   \n",
       "414972   stKD-HqTxDMylPonFyVdWA      Boardwalk Billys Raw Bar & Ribs        2   \n",
       "608519   0_J4y0aEmtuzgdsH2OfWQw                      Don't Tell Mama        3   \n",
       "998043   IOwuFFUwRljuOxatDCGm6w                   The House of Brews        1   \n",
       "1061     2SwC8wqpZC4B9iFVTgYT9A                               Casbah        4   \n",
       "351541   WNy1uzcmm_UHmTyR--o5IA                Cornish Pasty Company        5   \n",
       "716691   OdD1GuGNQ64ssJmMJ_D9RQ                             The Duce        1   \n",
       "1125     2SwC8wqpZC4B9iFVTgYT9A                               Casbah        5   \n",
       "900253   40xXIs_WIOvrhtbS7QJ1ZQ  Four Sevens Sports Bar & Restaurant        4   \n",
       "430613   6gugg5XY66ukGewmOptSKw            The Steakhouse at Camelot        3   \n",
       "...                         ...                                  ...      ...   \n",
       "177165   ErTR62P1wNPelAbHkr_9cw                     Fuego Steakhouse        5   \n",
       "245413   4bEjOyTaDG24SY5TxsaUNQ                         Mon Ami Gabi        5   \n",
       "364268   Vtx0VYkybAd71fzwgaoQ8g                The Skeptical Chymist        4   \n",
       "587462   RhqrOvy6Zr8vn5pJ9PkF1A                               Wazuzu        5   \n",
       "357168   KBG28p3lGX17hOPoHhq5PQ                    Yasu Sushi Bistro        5   \n",
       "234987   c7pNpJMmvRXBpC_8kj76nA                  Lang Van Vietnamese        5   \n",
       "601625   6nfTUgP3UvQ_jhnT8kCpew                            Hon Machi        4   \n",
       "440658   8o-NLKy_XfbJtqljX9XLCA         Mrs White's Golden Rule Cafe        5   \n",
       "410026   2AB_43WAw7cNvMcm-QEliw             Sushi Tower & Steakhouse        4   \n",
       "366903   fZVZeZJkziJ7B1rIcmT3Iw                          Sierra Gold        4   \n",
       "832706   IRYj1b1-mlXqABVsl9SoqQ                       Tacos El Gordo        5   \n",
       "481156   simnCuMX4OVwIhWaIqL4zA                            Red House        5   \n",
       "209427   r70nuDpkR5-g1oShW2ANvA           Crown & Anchor British Pub        5   \n",
       "463651   CEPvTz9BU_wK45zZoQNhrw                           Tequileria        2   \n",
       "808672   nZgYNbl1XlZyyKlISMoG6w     Sugar Factory American Brasserie        1   \n",
       "344165   FqzgT9Y-Yu7jiWdHnGW-kQ                              The Vig        5   \n",
       "980915   6O9iAmAv7vUl-Eeqb9bmpw                   Wahoo's Fish Tacos        3   \n",
       "144580   g3WAdIH2ULX6hFI6hOfBWw                            Got Sushi        1   \n",
       "189706   LOef7o-dnn7Z5qGMZCi6pw                                Circo        5   \n",
       "137545   NQhPkGeHiljeg7tXPTHJeA                       Sweet Tomatoes        4   \n",
       "868430   05fTEsjUPVo5jks8PpNKCQ                Rollin Smoke Barbeque        4   \n",
       "303238   UL3OMN_c-NXHlyb97pDifA                           Yard House        4   \n",
       "516017   r4AG1WXCRWkZKQctrcy9FA                  Grimaldi's Pizzeria        4   \n",
       "454032   SNTDhGh-AdBPKFfq6xCsRA                     Kings Fish House        5   \n",
       "1017805  TNpJsewe0H__8fzBgaHCzg                  Angelina's Pizzeria        4   \n",
       "300150   KlAARyLySLdoyT8QxJFSIg                   The Prime Rib Loft        4   \n",
       "938078   vDEC5kHgtjkqyuZAZrSuMA                            Pho Annie        4   \n",
       "986467   XfVGU6WGZKc867spn2TImw   Pomo Pizzeria Napoletana - Phoenix        4   \n",
       "54382    JNEeWjajyZPrwMb1cYi_pg                        Creative Cafe        5   \n",
       "251637   tFU2Js_nbIZOrnKfYJYBBg                       Bouchon Bistro        5   \n",
       "\n",
       "                                                      text  \\\n",
       "223202   You have to try the velvet!!! Lux is so to die...   \n",
       "365597   This joint is hit or miss on the nite scene......   \n",
       "399883   it's always fun to \"people watch\" on fremont c...   \n",
       "175018   Went for another try at Sunday Brunch. First o...   \n",
       "647870   I like and probably prefer a dive bar over hig...   \n",
       "1058274  What a great find! Service was awesome, food w...   \n",
       "538477   went there for \"the best in pizza in Charlotte...   \n",
       "26030    A clean dive bar neatly disguised as a sports ...   \n",
       "606932   This is my new favorite restaurant in Phoenix....   \n",
       "125852   Med plate is great, price is fair. Even the sm...   \n",
       "44114    This Review Brought to you by the Letter \"L\"\\n...   \n",
       "582925   My girlfriends & I recently went to Vegas for ...   \n",
       "975188   Food was cold at all stages of the meal. Dip T...   \n",
       "743863   Just had a great lunch at Ale House! Our serve...   \n",
       "893313   I'm not the one to go to clubs much, mainly be...   \n",
       "316312   Not really a sushi restaurant, woefully overpr...   \n",
       "606965   I have been to the Arcadia location quite a fe...   \n",
       "257517   Hofbrauhaus used to be a hidden gem in Vegas, ...   \n",
       "316133   Yes! Social House was fantastic at TI. It's mo...   \n",
       "31284    We parked in the back and came in through a se...   \n",
       "640078   As we walked towards TAO beach, we were greete...   \n",
       "414972   The best thing on this menu is the hot peel an...   \n",
       "608519   Nice little piano bar, I have heard about it's...   \n",
       "998043   Wow...this place has really gone down. New men...   \n",
       "1061     So I hated this Soba place owned by the same p...   \n",
       "351541   Wow...we loved this place!  I had bookmarked t...   \n",
       "716691   Cool place but don't try to arrange a special ...   \n",
       "1125     I enjoy coming to Casbah because it reminds me...   \n",
       "900253   Needed a good spot for an after work beverage ...   \n",
       "430613   The food was great. The service sucked. The wa...   \n",
       "...                                                    ...   \n",
       "177165   If there's one thing I know after spending the...   \n",
       "245413   We love this place. It is a must stop for us w...   \n",
       "364268   Came here on a Saturday night and the band was...   \n",
       "587462   Another great meal at Wazuzu.  Chef Jet is a s...   \n",
       "357168   I want to give this place 7 stars! My only reg...   \n",
       "234987   After spending the early afternoon at the Char...   \n",
       "601625   We went here on a Monday night and reluctantly...   \n",
       "440658   Been coming here for a few months, but tonight...   \n",
       "410026   I've been here quite a few times and I love it...   \n",
       "366903   I haven't been to Sierra Gold in quite a while...   \n",
       "832706   Hands down best taco joint I have ever been to...   \n",
       "481156   I told myself no more five stars but I love th...   \n",
       "209427   Bloody Brilliant! Excellent choice of beers on...   \n",
       "463651   Can I have more steak with this Fat!? Geez! It...   \n",
       "808672   I went to the Sugar Factory for breakfast last...   \n",
       "344165   Probably the best bowl of Posole that I have h...   \n",
       "980915   The food was alright, I guess.  Nothing too gr...   \n",
       "144580   This place made me so sick and I have an iron ...   \n",
       "189706   If you love eating fine cuisine, but cannot qu...   \n",
       "137545   Every once in a while after eating poorly, I n...   \n",
       "868430   Great food nice clean place! No real BBQ in Ve...   \n",
       "303238   I love this place for their fantastic martinis...   \n",
       "516017   I am fast becoming a pizza afficianado.    We ...   \n",
       "454032   Five stars to Kings for their generosity.\\n\\nM...   \n",
       "1017805  Pretty good pizza. Fast delivery. This used to...   \n",
       "300150   No thanks to our server, we will be back.\\n\\nT...   \n",
       "938078   Awesome place. Usually a return customer of th...   \n",
       "986467   Great vibe in this place. Very friendly staff....   \n",
       "54382    Just passing through town and found this great...   \n",
       "251637   No reservations and its always packed so get t...   \n",
       "\n",
       "                                                categories  target  \n",
       "223202   [Coffee & Tea, Food, Bars, Nightlife, American...    True  \n",
       "365597   [Pubs, Bars, American (Traditional), Nightlife...    True  \n",
       "399883    [Casinos, Bars, Arts & Entertainment, Nightlife]    True  \n",
       "175018   [American (Traditional), Steakhouses, Nightlif...    True  \n",
       "647870                          [Bars, Nightlife, Lounges]    True  \n",
       "1058274  [Bars, Restaurants, American (Traditional), Sp...    True  \n",
       "538477      [Italian, Bars, Pizza, Nightlife, Restaurants]    True  \n",
       "26030                             [Nightlife, Restaurants]    True  \n",
       "606932   [Bars, Breakfast & Brunch, Wine Bars, Nightlif...    True  \n",
       "125852   [Bars, Restaurants, American (Traditional), Sp...    True  \n",
       "44114    [Jazz & Blues, Arts & Entertainment, Soul Food...    True  \n",
       "582925                            [Nightlife, Dance Clubs]    True  \n",
       "975188   [Bars, American (Traditional), Pubs, Nightlife...    True  \n",
       "743863   [Nightlife, Bars, American (Traditional), Spor...    True  \n",
       "893313         [Bars, Hookah Bars, Nightlife, Dance Clubs]    True  \n",
       "316312   [Bars, Japanese, Asian Fusion, Nightlife, Loun...    True  \n",
       "606965   [Bars, Breakfast & Brunch, Wine Bars, Nightlif...    True  \n",
       "257517              [German, Bars, Nightlife, Restaurants]    True  \n",
       "316133   [Bars, Japanese, Asian Fusion, Nightlife, Loun...    True  \n",
       "31284          [Pubs, Bars, Nightlife, Irish, Restaurants]    True  \n",
       "640078   [Active Life, Swimming Pools, Dance Clubs, Nig...    True  \n",
       "414972   [Bars, American (Traditional), Nightlife, Spor...    True  \n",
       "608519                          [Bars, Nightlife, Lounges]    True  \n",
       "998043   [Nightlife, Bars, American (New), Sports Bars,...    True  \n",
       "1061     [Wine Bars, Bars, Mediterranean, Nightlife, Re...    True  \n",
       "351541       [Pubs, Bars, Nightlife, British, Restaurants]    True  \n",
       "716691                          [Bars, Nightlife, Lounges]    True  \n",
       "1125     [Wine Bars, Bars, Mediterranean, Nightlife, Re...    True  \n",
       "900253   [Bars, Restaurants, Sports Bars, Chinese, Nigh...    True  \n",
       "430613   [Bars, Steakhouses, American (Traditional), Ni...    True  \n",
       "...                                                    ...     ...  \n",
       "177165                          [Steakhouses, Restaurants]   False  \n",
       "245413   [Breakfast & Brunch, Steakhouses, French, Rest...   False  \n",
       "364268         [Pubs, Bars, Nightlife, Irish, Restaurants]    True  \n",
       "587462                               [Diners, Restaurants]   False  \n",
       "357168                           [Sushi Bars, Restaurants]   False  \n",
       "234987                           [Vietnamese, Restaurants]   False  \n",
       "601625                 [Sushi Bars, Japanese, Restaurants]   False  \n",
       "440658                  [Soul Food, Southern, Restaurants]   False  \n",
       "410026              [Steakhouses, Sushi Bars, Restaurants]   False  \n",
       "366903   [Bars, Pubs, Nightlife, American (New), Sports...    True  \n",
       "832706                              [Mexican, Restaurants]   False  \n",
       "481156                              [Chinese, Restaurants]   False  \n",
       "209427       [Pubs, Bars, Nightlife, British, Restaurants]    True  \n",
       "463651                              [Mexican, Restaurants]   False  \n",
       "808672   [Breakfast & Brunch, Bars, American (New), Nig...    True  \n",
       "344165   [Bars, American (Traditional), Pubs, Nightlife...    True  \n",
       "980915                     [Seafood, Mexican, Restaurants]   False  \n",
       "144580                             [Japanese, Restaurants]   False  \n",
       "189706                              [Restaurants, Italian]   False  \n",
       "137545           [Vegetarian, Buffets, Salad, Restaurants]   False  \n",
       "868430         [Burgers, Soul Food, Barbeque, Restaurants]   False  \n",
       "303238   [Nightlife, Vegetarian, American (New), Bars, ...    True  \n",
       "516017                                [Pizza, Restaurants]   False  \n",
       "454032                              [Seafood, Restaurants]   False  \n",
       "1017805                      [Italian, Pizza, Restaurants]   False  \n",
       "300150                          [Steakhouses, Restaurants]   False  \n",
       "938078                           [Vietnamese, Restaurants]   False  \n",
       "986467           [Italian, Pizza, Sandwiches, Restaurants]   False  \n",
       "54382                        [American (New), Restaurants]   False  \n",
       "251637           [Breakfast & Brunch, French, Restaurants]   False  \n",
       "\n",
       "[41806 rows x 6 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "combined"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Lemon\\Anaconda3\\envs\\mfe\\lib\\site-packages\\sklearn\\model_selection\\_split.py:2010: FutureWarning: From version 0.21, test_size will always complement train_size unless both are specified.\n",
      "  FutureWarning)\n"
     ]
    }
   ],
   "source": [
    "# Split into training and test data sets\n",
    "training_data, test_data = modsel.train_test_split(combined, \n",
    "                                                   train_size=0.7, \n",
    "                                                   random_state=123)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(29264, 6)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "training_data.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(12542, 6)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test_data.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Represent the review text as a bag-of-words \n",
    "bow_transform = text.CountVectorizer()\n",
    "X_tr_bow = bow_transform.fit_transform(training_data['text'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "46924"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(bow_transform.vocabulary_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(29264, 46924)"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_tr_bow.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "X_te_bow = bow_transform.transform(test_data['text'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "y_tr = training_data['target']\n",
    "y_te = test_data['target']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Create the tf-idf representation using the bag-of-words matrix\n",
    "tfidf_trfm = text.TfidfTransformer(norm=None)\n",
    "X_tr_tfidf = tfidf_trfm.fit_transform(X_tr_bow)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "X_te_tfidf = tfidf_trfm.transform(X_te_bow)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "X_tr_l2 = preproc.normalize(X_tr_bow, axis=0)\n",
    "X_te_l2 = preproc.normalize(X_te_bow, axis=0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Classify with logistic regression"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def simple_logistic_classify(X_tr, y_tr, X_test, y_test, description, _C=1.0):\n",
    "    ## Helper function to train a logistic classifier and score on test data\n",
    "    m = LogisticRegression(C=_C).fit(X_tr, y_tr)\n",
    "    s = m.score(X_test, y_test)\n",
    "    print ('Test score with', description, 'features:', s)\n",
    "    return m"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Test score with bow features: 0.775873066497\n",
      "Test score with l2-normalized features: 0.763514590974\n",
      "Test score with tf-idf features: 0.743182905438\n"
     ]
    }
   ],
   "source": [
    "m1 = simple_logistic_classify(X_tr_bow, y_tr, X_te_bow, y_te, 'bow')\n",
    "m2 = simple_logistic_classify(X_tr_l2, y_tr, X_te_l2, y_te, 'l2-normalized')\n",
    "m3 = simple_logistic_classify(X_tr_tfidf, y_tr, X_te_tfidf, y_te, 'tf-idf')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Tune regularization parameters using grid search"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "param_grid_ = {'C': [1e-5, 1e-3, 1e-1, 1e0, 1e1, 1e2]}\n",
    "bow_search = modsel.GridSearchCV(LogisticRegression(), cv=5, param_grid=param_grid_)\n",
    "l2_search = modsel.GridSearchCV(LogisticRegression(), cv=5,\n",
    "                               param_grid=param_grid_)\n",
    "tfidf_search = modsel.GridSearchCV(LogisticRegression(), cv=5,\n",
    "                                   param_grid=param_grid_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GridSearchCV(cv=5, error_score='raise',\n",
       "       estimator=LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True,\n",
       "          intercept_scaling=1, max_iter=100, multi_class='ovr', n_jobs=1,\n",
       "          penalty='l2', random_state=None, solver='liblinear', tol=0.0001,\n",
       "          verbose=0, warm_start=False),\n",
       "       fit_params={}, iid=True, n_jobs=1,\n",
       "       param_grid={'C': [1e-05, 0.001, 0.1, 1.0, 10.0, 100.0]},\n",
       "       pre_dispatch='2*n_jobs', refit=True, return_train_score=True,\n",
       "       scoring=None, verbose=0)"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bow_search.fit(X_tr_bow, y_tr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.78283898305084743"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bow_search.best_score_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GridSearchCV(cv=5, error_score='raise',\n",
       "       estimator=LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True,\n",
       "          intercept_scaling=1, max_iter=100, multi_class='ovr', n_jobs=1,\n",
       "          penalty='l2', random_state=None, solver='liblinear', tol=0.0001,\n",
       "          verbose=0, warm_start=False),\n",
       "       fit_params={}, iid=True, n_jobs=1,\n",
       "       param_grid={'C': [1e-05, 0.001, 0.1, 1.0, 10.0, 100.0]},\n",
       "       pre_dispatch='2*n_jobs', refit=True, return_train_score=True,\n",
       "       scoring=None, verbose=0)"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "l2_search.fit(X_tr_l2, y_tr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.77675642427556046"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "l2_search.best_score_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "GridSearchCV(cv=5, error_score='raise',\n",
       "       estimator=LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True,\n",
       "          intercept_scaling=1, max_iter=100, multi_class='ovr', n_jobs=1,\n",
       "          penalty='l2', random_state=None, solver='liblinear', tol=0.0001,\n",
       "          verbose=0, warm_start=False),\n",
       "       fit_params={}, iid=True, n_jobs=1,\n",
       "       param_grid={'C': [1e-05, 0.001, 0.1, 1.0, 10.0, 100.0]},\n",
       "       pre_dispatch='2*n_jobs', refit=True, return_train_score=True,\n",
       "       scoring=None, verbose=0)"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tfidf_search.fit(X_tr_tfidf, y_tr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.78864816839803176"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tfidf_search.best_score_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'C': 0.1}"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bow_search.best_params_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'C': 10.0}"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "l2_search.best_params_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'C': 0.001}"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tfidf_search.best_params_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'mean_fit_time': array([  0.43648252,   0.94630651,   5.64090128,  15.31248307,\n",
       "         31.47010217,  42.44257565]),\n",
       " 'mean_score_time': array([ 0.00080056,  0.00392466,  0.00864897,  0.00784755,  0.01192751,\n",
       "         0.0072515 ]),\n",
       " 'mean_test_score': array([ 0.57897075,  0.7518111 ,  0.78283898,  0.77381766,  0.75515992,\n",
       "         0.73937261]),\n",
       " 'mean_train_score': array([ 0.5792185 ,  0.76731652,  0.87697341,  0.94629064,  0.98357195,\n",
       "         0.99441294]),\n",
       " 'param_C': masked_array(data = [1e-05 0.001 0.1 1.0 10.0 100.0],\n",
       "              mask = [False False False False False False],\n",
       "        fill_value = ?),\n",
       " 'params': ({'C': 1e-05},\n",
       "  {'C': 0.001},\n",
       "  {'C': 0.1},\n",
       "  {'C': 1.0},\n",
       "  {'C': 10.0},\n",
       "  {'C': 100.0}),\n",
       " 'rank_test_score': array([6, 4, 1, 2, 3, 5]),\n",
       " 'split0_test_score': array([ 0.58028698,  0.75025624,  0.7799795 ,  0.7726341 ,  0.75247694,\n",
       "         0.74086095]),\n",
       " 'split0_train_score': array([ 0.57923964,  0.76860316,  0.87560871,  0.94434003,  0.9819308 ,\n",
       "         0.99470312]),\n",
       " 'split1_test_score': array([ 0.5786776 ,  0.74628396,  0.77669571,  0.76627371,  0.74867589,\n",
       "         0.73176149]),\n",
       " 'split1_train_score': array([ 0.57917218,  0.7684849 ,  0.87945837,  0.94822946,  0.98504976,\n",
       "         0.99538678]),\n",
       " 'split2_test_score': array([ 0.57816504,  0.75533914,  0.78472578,  0.76832394,  0.74799248,\n",
       "         0.7356911 ]),\n",
       " 'split2_train_score': array([ 0.57977019,  0.76613558,  0.87689548,  0.94566657,  0.98368288,\n",
       "         0.99397719]),\n",
       " 'split3_test_score': array([ 0.57894737,  0.75051265,  0.78332194,  0.77682843,  0.75768968,\n",
       "         0.73855092]),\n",
       " 'split3_train_score': array([ 0.57914745,  0.76678626,  0.87634546,  0.94558346,  0.98385443,\n",
       "         0.99474628]),\n",
       " 'split4_test_score': array([ 0.57877649,  0.75666439,  0.78947368,  0.78503076,  0.76896787,\n",
       "         0.75      ]),\n",
       " 'split4_train_score': array([ 0.57876303,  0.7665727 ,  0.87655903,  0.94763369,  0.98334188,\n",
       "         0.99325132]),\n",
       " 'std_fit_time': array([ 0.03874582,  0.02297261,  1.18862097,  1.83901079,  4.21516797,\n",
       "         2.93444269]),\n",
       " 'std_score_time': array([ 0.00160112,  0.00605009,  0.00623053,  0.00698687,  0.00713112,\n",
       "         0.00570195]),\n",
       " 'std_test_score': array([ 0.00070799,  0.00375907,  0.00432957,  0.00668246,  0.00771557,\n",
       "         0.00612049]),\n",
       " 'std_train_score': array([ 0.00032232,  0.00102466,  0.00131222,  0.00143229,  0.00100223,\n",
       "         0.00073252])}"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bow_search.cv_results_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pickle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "results_file = open('tfidf_gridcv_results.pkl', 'wb')\n",
    "pickle.dump(bow_search, results_file, -1)\n",
    "pickle.dump(tfidf_search, results_file, -1)\n",
    "pickle.dump(l2_search, results_file, -1)\n",
    "results_file.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Lemon\\Anaconda3\\envs\\mfe\\lib\\site-packages\\sklearn\\base.py:312: UserWarning: Trying to unpickle estimator LogisticRegression from version 0.18.2 when using version 0.19.0. This might lead to breaking code or invalid results. Use at your own risk.\n",
      "  UserWarning)\n",
      "C:\\Users\\Lemon\\Anaconda3\\envs\\mfe\\lib\\site-packages\\sklearn\\base.py:312: UserWarning: Trying to unpickle estimator GridSearchCV from version 0.18.2 when using version 0.19.0. This might lead to breaking code or invalid results. Use at your own risk.\n",
      "  UserWarning)\n"
     ]
    }
   ],
   "source": [
    "pkl_file = open('tfidf_gridcv_results.pkl', 'rb')\n",
    "bow_search = pickle.load(pkl_file)\n",
    "tfidf_search = pickle.load(pkl_file)\n",
    "l2_search = pickle.load(pkl_file)\n",
    "pkl_file.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>bow</th>\n",
       "      <th>l2</th>\n",
       "      <th>tfidf</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.578971</td>\n",
       "      <td>0.575724</td>\n",
       "      <td>0.721638</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.751811</td>\n",
       "      <td>0.575724</td>\n",
       "      <td>0.788648</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.782839</td>\n",
       "      <td>0.589120</td>\n",
       "      <td>0.763566</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.773818</td>\n",
       "      <td>0.734247</td>\n",
       "      <td>0.741150</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.755160</td>\n",
       "      <td>0.776756</td>\n",
       "      <td>0.721467</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0.739373</td>\n",
       "      <td>0.761106</td>\n",
       "      <td>0.712309</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "        bow        l2     tfidf\n",
       "0  0.578971  0.575724  0.721638\n",
       "1  0.751811  0.575724  0.788648\n",
       "2  0.782839  0.589120  0.763566\n",
       "3  0.773818  0.734247  0.741150\n",
       "4  0.755160  0.776756  0.721467\n",
       "5  0.739373  0.761106  0.712309"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "search_results = pd.DataFrame.from_dict({'bow': bow_search.cv_results_['mean_test_score'],\n",
    "                               'tfidf': tfidf_search.cv_results_['mean_test_score'],\n",
    "                               'l2': l2_search.cv_results_['mean_test_score']})\n",
    "search_results"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Plot cross validation results"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "sns.set_style(\"whitegrid\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Lemon\\Anaconda3\\envs\\mfe\\lib\\site-packages\\seaborn\\categorical.py:462: FutureWarning: remove_na is deprecated and is a private function. Do not use.\n",
      "  box_data = remove_na(group_data)\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAD5CAYAAADbY2myAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAH+NJREFUeJzt3XtUVOX+BvBngAEZIVxclMAUvMbFgBA1G6CsDMHWAs/x\ngsTF1GP9UCt1maQkeDlHNLOw44US1Mh1IlfaOXLR0jwuw4U4oXgS0QETy0QuKspAg8DvD47TmcB8\npbnC81mrlfudvd/93YLzzLvfvfdI2tvb20FERCTAwtgFEBGR+WBoEBGR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YQ4OIiIQx\nNIiISBhDg4iIhDE0iIhIGEODiIiEMTSIiEjY/wOfgdKZLZlTdQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1f8953b9390>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "ax = sns.boxplot(data=search_results, width=0.4)\n",
    "ax.set_ylabel('Accuracy', size=14)\n",
    "ax.tick_params(labelsize=14)\n",
    "plt.savefig('tfidf_gridcv_results.png')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Test score with bow features: 0.78360708021\n",
      "Test score with l2-normalized features: 0.780178599904\n",
      "Test score with tf-idf features: 0.788470738319\n"
     ]
    }
   ],
   "source": [
    "m1 = simple_logistic_classify(X_tr_bow, y_tr, X_te_bow, y_te, 'bow', \n",
    "                              _C=bow_search.best_params_['C'])\n",
    "m2 = simple_logistic_classify(X_tr_l2, y_tr, X_te_l2, y_te, 'l2-normalized', \n",
    "                              _C=l2_search.best_params_['C'])\n",
    "m3 = simple_logistic_classify(X_tr_tfidf, y_tr, X_te_tfidf, y_te, 'tf-idf', \n",
    "                              _C=tfidf_search.best_params_['C'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.57897075,  0.7518111 ,  0.78283898,  0.77381766,  0.75515992,\n",
       "        0.73937261])"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bow_search.cv_results_['mean_test_score']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
